package com.qf.cqut.Service.impl;

import com.qf.cqut.Service.FoodService;
import com.qf.cqut.mapper.AFoodMapper;
import com.qf.cqut.model.pojo.AFood;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class FoodServiceImpl implements FoodService {

    @Resource
    private AFoodMapper aFoodMapper;

    @Override
    public List<AFood> selectAll() {

        List<AFood> aFoodList = aFoodMapper.selectAll();
        return aFoodList;
    }

    @Override
    public List<AFood> selectByLimit(Integer page, Integer limit) {
        if(page != null && limit != null){
            page = (page - 1) * limit;
        }else{
            page = 0;
            limit = 10;
        }
        return aFoodMapper.selectByLimit(page,limit);
    }

    @Override
    public Integer count() {

        return aFoodMapper.count();
    }

    @Override
    public Integer delByIds(String[] ids) {
        return aFoodMapper.deleteByIds(ids);
    }

    @Override
    public List<AFood> queryByConditions(AFood aFood) {
        return aFoodMapper.queryByConditions(aFood);
    }

    @Override
    public Integer addAfood(AFood aFood) {
        return aFoodMapper.addAfood(aFood);
    }

    @Override
    public Integer editAfood(AFood aFood) {
        return aFoodMapper.editAfood(aFood);
    }

    @Override
    public Integer executeAplan1(AFood aFood) {

        return aFoodMapper.executeAplan1(aFood);
    }

    @Override
    public Integer executeAreturn1(AFood aFood) {
        return aFoodMapper.executeAreturn1(aFood);
    }

    @Override
    public Integer executeAplan(AFood aFood) {
        return aFoodMapper.executeAplan(aFood);
    }

    @Override
    public Integer executeAplan2(AFood aFood) {
        return aFoodMapper.executeAplan2(aFood);
    }



}
